home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_315 / surf / menu_image.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  7KB  |  237 lines

  1. #include "menuexp.h"
  2.  
  3.  
  4. /*
  5.  * Menu description for selecting color mapping
  6.  */
  7. static struct IntuiText Specular = {
  8.      0, 1, JAM2, 20, 0, NULL, (UBYTE *)"Specular",  NULL
  9. };
  10.  
  11. static struct IntuiText revtext[] = {
  12.    { 0, 1, JAM2, 2, 0, NULL, (UBYTE *)"Rev. Axis",  NULL },
  13.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"X",   NULL },
  14.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"Y",   NULL }
  15. };
  16.  
  17. static struct IntuiText dithertext[] = {
  18.    { 0, 1, JAM2, 2, 0, NULL, (UBYTE *)"Dither",   NULL },
  19.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"none",   NULL },
  20.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"2",   NULL },
  21.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"4",   NULL },
  22.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"8",   NULL },
  23.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"16",   NULL },
  24.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"32",   NULL },
  25.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"64",   NULL },
  26.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"128",   NULL }
  27. };
  28.  
  29.  
  30. static struct IntuiText MiscText[] = {
  31.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"Abort Draw",   NULL },
  32.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"Debug",   NULL },
  33.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"Flip XY Map", NULL }
  34. };
  35.  
  36. struct MenuItem revitems[] = {
  37.   { &revitems[1], /* next item */
  38.     90, 0, 80 , 10, /* x,y,w,h */
  39.     COLMEMFLAGS| CHECKED,
  40.     2, /* mutual exclude bits */
  41.     (APTR) &revtext[1],  /* grey */
  42.     NULL, /* highlight image */
  43.     'h', /* command byte ? */
  44.     NULL, /* submenu item */
  45.     0 /* next select for select dragging */
  46.     },
  47.   { NULL, /* next item */
  48.     90, 10, 80 , 10, /* x,y,w,h */
  49.     COLMEMFLAGS,
  50.     1, /* mutual exclude bits */
  51.     (APTR) &revtext[2],  /* grey */
  52.     NULL, /* highlight image */
  53.     'h', /* command byte ? */
  54.     NULL, /* submenu item */
  55.     0 /* next select for select dragging */
  56.     }
  57. };
  58.  
  59. #define DitherExMask(X) (((1<<8)-1) ^ (1<<X))
  60.  
  61. struct MenuItem ditheritems[] = {
  62.   { &ditheritems[1], /* next item */
  63.     90, 0, 80 , 10, /* x,y,w,h */
  64.     COLMEMFLAGS,
  65.     DitherExMask(0), /* mutual exclude bits */
  66.     (APTR) &dithertext[1],  /* grey */
  67.     NULL, /* highlight image */
  68.     'h', /* command byte ? */
  69.     NULL, /* submenu item */
  70.     0 /* next select for select dragging */
  71.     },
  72.   { &ditheritems[2], /* next item */
  73.     90, 10, 80 , 10, /* x,y,w,h */
  74.     COLMEMFLAGS,
  75.     DitherExMask(1), /* mutual exclude bits */
  76.     (APTR) &dithertext[2],  /* grey */
  77.     NULL, /* highlight image */
  78.     'h', /* command byte ? */
  79.     NULL, /* submenu item */
  80.     0 /* next select for select dragging */
  81.     },
  82.   { &ditheritems[3], /* next item */
  83.     90, 20, 80 , 10, /* x,y,w,h */
  84.     COLMEMFLAGS| CHECKED,
  85.     DitherExMask(2), /* mutual exclude bits */
  86.     (APTR) &dithertext[3],  /* grey */
  87.     NULL, /* highlight image */
  88.     'h', /* command byte ? */
  89.     NULL, /* submenu item */
  90.     0 /* next select for select dragging */
  91.     },
  92.   { &ditheritems[4], /* next item */
  93.     90, 30, 80 , 10, /* x,y,w,h */
  94.     COLMEMFLAGS,
  95.     DitherExMask(3), /* mutual exclude bits */
  96.     (APTR) &dithertext[4],  /* grey */
  97.     NULL, /* highlight image */
  98.     'h', /* command byte ? */
  99.     NULL, /* submenu item */
  100.     0 /* next select for select dragging */
  101.     },
  102.   { &ditheritems[5], /* next item */
  103.     90, 40, 80 , 10, /* x,y,w,h */
  104.     COLMEMFLAGS,
  105.     DitherExMask(4), /* mutual exclude bits */
  106.     (APTR) &dithertext[5],  /* grey */
  107.     NULL, /* highlight image */
  108.     'h', /* command byte ? */
  109.     NULL, /* submenu item */
  110.     0 /* next select for select dragging */
  111.     },
  112.   { &ditheritems[6], /* next item */
  113.     90, 50, 80 , 10, /* x,y,w,h */
  114.     COLMEMFLAGS,
  115.     DitherExMask(5), /* mutual exclude bits */
  116.     (APTR) &dithertext[6],  /* grey */
  117.     NULL, /* highlight image */
  118.     'h', /* command byte ? */
  119.     NULL, /* submenu item */
  120.     0 /* next select for select dragging */
  121.     },
  122.   { &ditheritems[7], /* next item */
  123.     90, 60, 80 , 10, /* x,y,w,h */
  124.     COLMEMFLAGS,
  125.     DitherExMask(6), /* mutual exclude bits */
  126.     (APTR) &dithertext[7],  /* grey */
  127.     NULL, /* highlight image */
  128.     'h', /* command byte ? */
  129.     NULL, /* submenu item */
  130.     0 /* next select for select dragging */
  131.     },
  132.   { NULL, /* next item */
  133.     90, 70, 80 , 10, /* x,y,w,h */
  134.     COLMEMFLAGS,
  135.     DitherExMask(7), /* mutual exclude bits */
  136.     (APTR) &dithertext[8],  /* grey */
  137.     NULL, /* highlight image */
  138.     'h', /* command byte ? */
  139.     NULL, /* submenu item */
  140.     0 /* next select for select dragging */
  141.     }
  142. };
  143.  
  144.  
  145. #define IMAGE_HITWIDTH 96
  146.  
  147. struct MenuItem imageitems[] = {
  148.   { &imageitems[1], /* next item */
  149.     1, 0, IMAGE_HITWIDTH , 10, /* x,y,w,h */
  150.     COLMEMFLAGS,
  151.     2, /* mutual exclude bits */
  152.     (APTR) &revtext[0],  /* grey */
  153.     NULL, /* highlight image */
  154.     'h', /* command byte ? */
  155.     revitems, /* submenu item */
  156.     0 /* next select for select dragging */
  157.     },
  158.   { &imageitems[2], /* next item */
  159.     1, 10, IMAGE_HITWIDTH , 10, /* x,y,w,h */
  160.     COLMEMFLAGS,
  161.     1, /* mutual exclude bits */
  162.     (APTR) &dithertext[0],     /* red */
  163.     NULL, /* highlight image */
  164.     'h', /* command byte ? */
  165.     ditheritems, /* submenu item */
  166.     0 /* next select for select dragging */
  167.     },
  168.   { &imageitems[3], /* next item */
  169.     1, 20, IMAGE_HITWIDTH , 10, /* x,y,w,h */
  170.     COLMEMFLAGS|MENUTOGGLE,
  171.     0, /* mutual exclude bits */
  172.     (APTR) &Specular,
  173.     NULL, /* highlight image */
  174.     'h', /* command byte ? */
  175.     NULL, /* submenu item */
  176.     0 /* next select for select dragging */
  177.     },
  178.   { &imageitems[4], /* next item */
  179.     1, 30, IMAGE_HITWIDTH , 10, /* x,y,w,h */
  180.     COLMEMFLAGS|MENUTOGGLE,
  181.     0, /* mutual exclude bits */
  182.     (APTR) &MiscText[2], /* Flip XY */
  183.     NULL, /* highlight image */
  184.     'h', /* command byte ? */
  185.     NULL, /* submenu item */
  186.     0 /* next select for select dragging */
  187.     },
  188.   { &imageitems[5], /* next item */
  189.     1, 40, 100 , 10, /* x,y,w,h */
  190.     COLMEMFLAGS| MENUTOGGLE,
  191.     0, /* mutual exclude bits */
  192.     (APTR) &MiscText[0], /* AbortDraw */
  193.     NULL, /* highlight image */
  194.     'h', /* command byte ? */
  195.     NULL, /* submenu item */
  196.     0 /* next select for select dragging */
  197.     },
  198.   { NULL, /* next item */
  199.     1, 50, IMAGE_HITWIDTH, 10, /* x,y,w,h */
  200.     COLMEMFLAGS|MENUTOGGLE,
  201.     0, /* mutual exclude bits */
  202.     (APTR) &MiscText[1],   /* debug */
  203.     NULL, /* highlight image */
  204.     'h', /* command byte ? */
  205.     NULL, /* submenu item */
  206.     0 /* next select for select dragging */
  207.     }
  208. };
  209.  
  210. USHORT *AbortDrawPtr = &imageitems[4].Flags;
  211. USHORT *DebugOnPtr = &imageitems[5].Flags;
  212.  
  213.  
  214. static void MenuSetImage()
  215. {
  216.     int i;
  217.     if( Selected(revitems[0])) {
  218.         SetRevAxis(0); /* Xaxis */
  219.     }
  220.     else {
  221.         SetRevAxis(1); /* Yaxis */
  222.     }
  223.  
  224.     for( i = 0; i < sizeof(ditheritems)/sizeof(ditheritems[0]); i++ ) {
  225.         if( Selected(ditheritems[i] )) {
  226.             if( i != DitherPower ) {
  227.                 FreeOldDither();
  228.             }
  229.             DitherPower = i;
  230.         }
  231.     }
  232.  
  233.     SpecOn = Selected( imageitems[2])?true:false;
  234.     FlipImgPix( Selected(imageitems[3])?true:false);
  235. }
  236.  
  237.